import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
export const ROOT_CHILDREN: RouteRecordRaw[] = [
  {
    path: '/',
    meta: {
      title: '首页'
    },
    component: () => import('../views/home/index.vue')
  },
  {
    path: '/list',
    meta: {
      title: '列表'
    },
    children: [
      {
        path: '/listmanage',
        meta: {
          title: '用户管理'
        },
        component: () => import('../views/listmanage/index.vue')
      }, {
        path: '/list',
        meta: {
          title: '三级列表'
        },
        children: [
          {
            path: '/listuser',
            meta: {
              title: '用户管理'
            },
            component: () => import('../views/listuser/index.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/set',
    meta: {
      title: '设置',roles: ['admin']
    },
    
    component: () => import('../views/set/index.vue'),
    
  }
]
const ROOT_ROUTES: RouteRecordRaw[] = [
  {
    path: '/',
    meta: {
      title: '主页'
    },
    children: ROOT_CHILDREN,
    component: () => import('../views/layout/index.vue')
  },
  {
    path: '/login',
    meta: {
      title: '登录'
    },
    component: () => import('../views/login/index.vue')
  }
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: ROOT_ROUTES
})

export default router
